<?php

	class Campaign_model extends CI_Model {

		protected $__tbname = 'campaign';
		protected $__dbconf = 'default';

		var $id;	//bigint(20) unsigned	Primary Key	Auto Increment	NOT NULL
		var $name;	//varchar(100)			NOT NULL
		var $id_network;	//tinyint(2)			NOT NULL
		var $created_date;	//datetime			NOT NULL
		var $country;	//varchar(500)			NULL
		var $description;	//varchar(255)			NULL
		var $status = 1;	//tinyint(2)			NOT NULL
		var $click_target = 0;	//int(11)			NOT NULL
		var $click_current = 0;	//int(11)			NOT NULL
		var $url;	//varchar(255)			NOT NULL
		var $id_user;	//bigint(20)			NOT NULL
		var $is_deleted = 0;	//tinyint(1)			NULL
		var $image;	//varchar(250)			NULL
		var $start_date;	//datetime			NOT NULL

		protected $__validation_rule = array(
			'id' => array('key' => 'PRI', 'type' => 'bigint', 'null' => FALSE, 'auto_increment' => TRUE),
			'name' => array('type' => 'varchar', 'size' => 100, 'null' => FALSE),
			'id_network' => array('type' => 'tinyint', 'null' => FALSE),
			'created_date' => array('type' => 'datetime', 'null' => FALSE),
			'country' => array('type' => 'varchar', 'size' => 500, 'null' => TRUE),
			'description' => array('type' => 'varchar', 'size' => 255, 'null' => TRUE),
			'status' => array('type' => 'tinyint', 'null' => FALSE),
			'click_target' => array('type' => 'int', 'null' => FALSE),
			'click_current' => array('type' => 'int', 'null' => FALSE),
			'url' => array('type' => 'varchar', 'size' => 255, 'null' => FALSE),
			'id_user' => array('type' => 'bigint', 'null' => FALSE),
			'is_deleted' => array('type' => 'tinyint', 'null' => TRUE),
			'image' => array('type' => 'varchar', 'size' => 250, 'null' => TRUE),
			'start_date' => array('type' => 'datetime', 'null' => FALSE)
		);

		protected $__relation = array(
			array('table' => 'network', 'foreign_key' => 'id_network'),
			array('table' => 'user', 'foreign_key' => 'id_user')
		);
	}
